#ifndef CUTILS_H
#define CUTILS_H

#include <stdint.h>

class CUtils;
class CConfig;

extern int16_t (CUtils::*BigShort)(int16_t s);
extern int16_t (CUtils::*LittleShort)( int16_t s);
extern int32_t (CUtils::*BigLong)(int32_t l);
extern int32_t (CUtils::*LittleLong)(int32_t l);
extern float (CUtils::*BigFloat)(float f);
extern float (CUtils::*LittleFloat)(float f);
extern double (CUtils::*BigDouble)(double d);
extern double (CUtils::*LittleDouble)(double d);

extern CUtils *g_Utils;
extern CConfig *g_Config;

class CUtils
{
private:
    // Endian Underlying Swap Functions

    // This endian swapping assumes that float is 4 bytes large and double is 8 bytes large.

    int16_t ShortSwap(int16_t s);
    int16_t ShortNoSwap(int16_t s);
    int32_t LongSwap(int32_t l);
    int32_t LongNoSwap(int32_t l);
    float FloatSwap(float f);
    float FloatNoSwap(float f);
    double DoubleSwap(double d);
    double DoubleNoSwap(double d);

public:
    void InitUtils();
};

#endif // CUTILS_H
